<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

<script>
    function Person(name) {
        this.name = name;
        this.obj = {
            name: 'obj',
            foo1: function () {
                return function () {
                    console.log(this.name);
                }
            },
            foo2: function () {
                return () => {
                    console.log(this.name);
                }
            }
        }
    }

    var person1 = new Person('person1');
    var person2 = new Person('person2');

    person1.obj.foo1()() // window
    person1.obj.foo1.call(person2)() // window
    person1.obj.foo1().call(person2) // person2

    person1.obj.foo2()() // obj
    person1.obj.foo2.call(person2)() // person2
    person1.obj.foo2().call(person2) // obj

</script>

</body>
</html>